
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>视图层 · classbro-light-weight-web</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Gj">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../index.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="vuex.html" />
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    引导
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">src</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../framework.html">
            
                <a href="../framework.html">
            
                    
                    架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../design.html">
            
                <a href="../design.html">
            
                    
                    设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../wechat.html">
            
                <a href="../wechat.html">
            
                    
                    企业微信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" >
            
                <span>
            
                    
                    账户资料
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="2.4.1" data-path="views.html">
            
                <a href="views.html">
            
                    
                    视图层
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="vuex.html">
            
                <a href="vuex.html">
            
                    
                    MVC 模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >视图层</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x89C6;&#x56FE;&#x5C42;">&#x89C6;&#x56FE;&#x5C42;</h1>
<blockquote>
<p>&#x8D26;&#x6237;&#x4FE1;&#x606F;&#x4E0B;&#x89C6;&#x56FE;&#x8868;&#x73B0;&#x5C42;</p>
<p>Views&#x4E0B;&#x53EA;&#x505A;Dom&#x5143;&#x7D20;&#x7684;&#x5C55;&#x793A;&#x548C;&#x4EA4;&#x4E92;</p>
</blockquote>
<h4 id="&#x76EE;&#x5F55;">&#x76EE;&#x5F55;</h4>
<blockquote>
<p>src/views/customer/material</p>
</blockquote>
<h4 id="views&#x7ED3;&#x5408;vuex">Views&#x7ED3;&#x5408;Vuex</h4>
<blockquote>
<p>views&#x4E0B;&#x6570;&#x636E;&#x901A;&#x8FC7; Store&#x4E0B;&#x7684;state&#x83B7;&#x53D6;&#xFF0C;&#x53D6;&#x4EE3; vue&#x91CC;&#x7684; $data</p>
<p>vue&#x91CC; $data &#x53EA;&#x505A;Dom&#x5C42;&#x4EA4;&#x4E92;&#x6216;&#x5F53;&#x524D;&#x9875;&#x9762;form&#x8868;&#x5355;&#x7684;cache</p>
</blockquote>
<pre class="language-"><code class="lang-javascript"><span class="token operator">&lt;</span>script<span class="token operator">&gt;</span>
<span class="token comment">/* &#x5BA2;&#x6237;&#x8D44;&#x6599; */</span>

<span class="token keyword">import</span> <span class="token punctuation">{</span> mapState <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vuex&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Gender2Css<span class="token punctuation">,</span> GradeList <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;./Cfg&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> validatePhone <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils/Validate&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Customer <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/store/dispatch/index&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Storage <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils/Enum/index&quot;</span><span class="token punctuation">;</span>

<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  components<span class="token operator">:</span> <span class="token punctuation">{</span> fieldTemp<span class="token punctuation">,</span> selectTemp<span class="token punctuation">,</span> tabsTemp<span class="token punctuation">,</span> tagsTemp <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
      rulePhone<span class="token operator">:</span> <span class="token punctuation">{</span> trigger<span class="token operator">:</span> <span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span> validator<span class="token operator">:</span> validatePhone <span class="token punctuation">}</span><span class="token punctuation">,</span>
      ruleEmail<span class="token operator">:</span> <span class="token punctuation">{</span> trigger<span class="token operator">:</span> <span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span> type<span class="token operator">:</span> <span class="token string">&quot;email&quot;</span><span class="token punctuation">,</span> message<span class="token operator">:</span> <span class="token string">&quot;&#x90AE;&#x7BB1;&#x683C;&#x5F0F;&#x9519;&#x8BEF;&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
      isExpend<span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>
      Gender2Css<span class="token punctuation">,</span>
      GradeList<span class="token punctuation">,</span>
      intervalId<span class="token operator">:</span> <span class="token keyword">null</span><span class="token punctuation">,</span>
      WxGendor<span class="token punctuation">,</span>
      bodyShow<span class="token operator">:</span> <span class="token boolean">false</span>
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  computed<span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token operator">...</span><span class="token function">mapState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
      <span class="token function-variable function">form</span><span class="token operator">:</span> <span class="token parameter">e</span> <span class="token operator">=&gt;</span> e<span class="token punctuation">.</span>customer_material<span class="token punctuation">.</span>user<span class="token punctuation">,</span>
      <span class="token function-variable function">countryList</span><span class="token operator">:</span> <span class="token parameter">e</span> <span class="token operator">=&gt;</span> e<span class="token punctuation">.</span>customer_material<span class="token punctuation">.</span>countryList<span class="token punctuation">,</span>
      <span class="token function-variable function">schoolList</span><span class="token operator">:</span> <span class="token parameter">e</span> <span class="token operator">=&gt;</span> e<span class="token punctuation">.</span>customer_material<span class="token punctuation">.</span>schoolList<span class="token punctuation">,</span>
      <span class="token function-variable function">majorList</span><span class="token operator">:</span> <span class="token parameter">e</span> <span class="token operator">=&gt;</span> e<span class="token punctuation">.</span>customer_material<span class="token punctuation">.</span>majorList<span class="token punctuation">,</span>
      <span class="token function-variable function">eduList</span><span class="token operator">:</span> <span class="token parameter">e</span> <span class="token operator">=&gt;</span> e<span class="token punctuation">.</span>customer_material<span class="token punctuation">.</span>eduList<span class="token punctuation">,</span>
      <span class="token function-variable function">loading</span><span class="token operator">:</span> <span class="token parameter">e</span> <span class="token operator">=&gt;</span> e<span class="token punctuation">.</span>customer_material<span class="token punctuation">.</span>loading
    <span class="token punctuation">}</span><span class="token punctuation">)</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  methods<span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token comment">/* &#x6839;&#x636E;&#x56FD;&#x5BB6;id&#x83B7;&#x53D6;&#x5B66;&#x6821;&#x5217;&#x8868; */</span>
    <span class="token keyword">async</span> <span class="token function">getSchoolByCountryId</span><span class="token punctuation">(</span><span class="token parameter">id</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span>universityId <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
      <span class="token keyword">await</span> Customer<span class="token punctuation">.</span>Material<span class="token punctuation">.</span><span class="token function">getSchoolListByCountryId</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="vuex.html" class="navigation navigation-next navigation-unique" aria-label="Next page: MVC 模式">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"视图层","level":"2.4.1","depth":2,"next":{"title":"MVC 模式","level":"2.4.2","depth":2,"path":"src/account/vuex.md","ref":"src/account/vuex.md","articles":[]},"previous":{"title":"账户资料","level":"2.4","depth":1,"ref":"","articles":[{"title":"视图层","level":"2.4.1","depth":2,"path":"src/account/views.md","ref":"src/account/views.md","articles":[]},{"title":"MVC 模式","level":"2.4.2","depth":2,"path":"src/account/vuex.md","ref":"src/account/vuex.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","-lunr","-search","search-pro","-highlight","prism"],"styles":{"website":"index.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"expandable-chapters":{},"search-pro":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Gj","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"classbro-light-weight-web","language":"zh-hans","gitbook":"3.2.3","description":"效率应用"},"file":{"path":"src/account/views.md","mtime":"2020-07-28T06:06:25.785Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-28T06:09:20.949Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

